lightning web components 您所在的位置:网站首页 Static JavaScript resource with LWC lightning web components

lightning web components

2024-05-21 01:34| 来源: 网络整理| 查看: 265

There are a few different options:

Share CSS styles among LWC components (Summer 20' update):

Create a component that contains a CSS file and configuration file.

>custom.css >custom.js-meta.xml

Then import it in the component you want to use the CSS file in.

/** myComponent.css **/ @import 'c/custom'; /* Define other style rules for myComponent here */

https://releasenotes.docs.salesforce.com/en-us/summer20/release-notes/rn_lwc_css_share.htm

LWC - You can do it like above with loadStyle: import { loadStyle } from 'lightning/platformResourceLoader'; renderedCallback() { Promise.all([ loadStyle(this, resourcePath + '/custom.css'); ]) } Loading static CSS resource into a custom theme - works for both LWC and Aura. This is a nice solution if you are still using both types of Web Components.

For aura:



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有